package com.smart.community.commons.constant;

import com.smart.community.commons.enums.SystemStatusEnum;
import com.smart.community.commons.enums.GenderEnum;

/**
 * 业务通用常量类
 * 
 * @author Wu.Liang
 * @version 1.0.0
 * @since 2024-12-19
 */
public class BusinessConstants {
    
    // 工具类，防止实例化
    private BusinessConstants() {
    }
    
    // ========================= 系统通用常量 =========================
    
    /**
     * 通用状态常量
     */
    public static final class CommonStatus {
        /** 启用/开启 */
        public static final Integer ENABLED = SystemStatusEnum.ENABLED.getCode();
        /** 禁用/关闭 */
        public static final Integer DISABLED = SystemStatusEnum.DISABLED.getCode();
        /** 锁定 */
        public static final Integer LOCKED = SystemStatusEnum.LOCKED.getCode();
    }
    
    /**
     * 删除标记常量
     */
    public static final class DeletedFlag {
        /** 未删除 */
        public static final Integer NOT_DELETED = 0;
        /** 已删除 */
        public static final Integer DELETED = 1;
    }
    
    // ========================= 用户管理通用常量 =========================
    
    /**
     * 用户类型常量
     */
    public static final class UserType {
        /** 居民 */
        public static final Integer RESIDENT = 1;
        /** 物业 */
        public static final Integer PROPERTY = 2;
        /** 管理员 */
        public static final Integer ADMIN = 3;
    }
    
    /**
     * 用户状态常量
     */
    public static final class UserStatus {
        /** 启用 */
        public static final Integer ENABLED = SystemStatusEnum.ENABLED.getCode();
        /** 禁用 */
        public static final Integer DISABLED = SystemStatusEnum.DISABLED.getCode();
        /** 锁定 */
        public static final Integer LOCKED = SystemStatusEnum.LOCKED.getCode();
    }
    
    /**
     * 性别常量
     */
    public static final class Gender {
        /** 未知 */
        public static final Integer UNKNOWN = 0;
        /** 男 */
        public static final Integer MALE = 1;
        /** 女 */
        public static final Integer FEMALE = 2;
        /** 其他 */
        public static final Integer OTHER = 4;
    }
    
    // ========================= 区域管理通用常量 =========================
    
    /**
     * 区域类型常量
     */
    public static final class RegionType {
        /** 省 */
        public static final Integer PROVINCE = 1;
        /** 市 */
        public static final Integer CITY = 2;
        /** 区县 */
        public static final Integer DISTRICT = 3;
        /** 街道 */
        public static final Integer STREET = 4;
        /** 社区 */
        public static final Integer COMMUNITY = 5;
    }
    
    /**
     * 区域层级常量
     */
    public static final class RegionLevel {
        /** 一级 */
        public static final Integer LEVEL_1 = 1;
        /** 二级 */
        public static final Integer LEVEL_2 = 2;
        /** 三级 */
        public static final Integer LEVEL_3 = 3;
        /** 四级 */
        public static final Integer LEVEL_4 = 4;
        /** 五级 */
        public static final Integer LEVEL_5 = 5;
    }
    
    /**
     * 区域状态常量
     */
    public static final class RegionStatus {
        /** 启用 */
        public static final Integer ENABLED = SystemStatusEnum.ENABLED.getCode();
        /** 禁用 */
        public static final Integer DISABLED = SystemStatusEnum.DISABLED.getCode();
    }
    
    // ========================= 审核状态常量 =========================
    
    /**
     * 审核状态常量
     */
    public static final class AuditStatus {
        /** 待审核 */
        public static final Integer PENDING = SystemStatusEnum.AUDIT_PENDING.getCode();
        /** 审核通过 */
        public static final Integer APPROVED = SystemStatusEnum.AUDIT_APPROVED.getCode();
        /** 审核拒绝 */
        public static final Integer REJECTED = SystemStatusEnum.AUDIT_REJECTED.getCode();
    }
    
    // ========================= 优先级常量 =========================
    
    /**
     * 优先级常量
     */
    public static final class Priority {
        /** 低 */
        public static final Integer LOW = 3;
        /** 中 */
        public static final Integer MEDIUM = 2;
        /** 高 */
        public static final Integer HIGH = 1;
    }
    
    // ========================= 紧急程度常量 =========================
    
    /**
     * 紧急程度常量
     */
    public static final class UrgencyLevel {
        /** 不紧急 */
        public static final Integer NORMAL = 2;
        /** 紧急 */
        public static final Integer URGENT = 1;
    }
    
    // ========================= 工具方法 =========================
    
    /**
     * 获取用户类型名称
     */
    public static String getUserTypeName(Integer userType) {
        if (userType == null) return "未知";
        switch (userType) {
            case 1: return "居民";
            case 2: return "物业";
            case 3: return "管理员";
            default: return "未知";
        }
    }
    
    /**
     * 获取用户状态名称
     */
    public static String getUserStatusName(Integer status) {
        if (status == null) return "未知";
        switch (status) {
            case 0: return "禁用";
            case 1: return "启用";
            case 2: return "锁定";
            default: return "未知";
        }
    }
    
    /**
     * 获取性别名称
     */
    public static String getGenderName(Integer gender) {
        return GenderEnum.getNameByCode(gender);
    }
    
    /**
     * 获取区域类型名称
     */
    public static String getRegionTypeName(Integer regionType) {
        if (regionType == null) return "未知";
        switch (regionType) {
            case 1: return "省";
            case 2: return "市";
            case 3: return "区县";
            case 4: return "街道";
            case 5: return "社区";
            default: return "未知";
        }
    }
    
    /**
     * 获取审核状态名称
     */
    public static String getAuditStatusName(Integer status) {
        if (status == null) return "未知";
        switch (status) {
            case 0: return "待审核";
            case 1: return "审核通过";
            case 2: return "审核拒绝";
            default: return "未知";
        }
    }
    
    /**
     * 获取优先级名称
     */
    public static String getPriorityName(Integer priority) {
        if (priority == null) return "未知";
        switch (priority) {
            case 1: return "高";
            case 2: return "中";
            case 3: return "低";
            default: return "未知";
        }
    }
    
    /**
     * 获取紧急程度名称
     */
    public static String getUrgencyLevelName(Integer urgencyLevel) {
        if (urgencyLevel == null) return "未知";
        switch (urgencyLevel) {
            case 1: return "紧急";
            case 2: return "一般";
            case 3: return "不紧急";
            default: return "未知";
        }
    }
}
